package cn.fanqinghong.ymcc.feignClient;

import cn.fanqinghong.ymcc.domain.MessageSms;
import cn.fanqinghong.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * FAN
 * 2022/7/19  14:06
 */
@Component
public class MessageSmsFallbackFactory implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new MessageSmsFeignClient() {
            @Override
            public JSONResult get(String mobile) {
                return JSONResult.error("服务到达不了","5000");
            }

            @Override
            public JSONResult batch(List<MessageSms> messageSms) {
                return JSONResult.error("服务到达不了","5000");
            }

            @Override
            public JSONResult saveBatch(List<MessageSms> messageSmss) {
                return JSONResult.error("报错短信错误");
            }

        };
    }
}
